package com.sat.seckill.service.Impl;

import com.sat.seckill.model.SeckillGoods;
import com.sat.seckill.service.SeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SeckillServiceImpl implements SeckillService {

    @Autowired
    private RedisTemplate redisTemplate;
    @Override
    public List<SeckillGoods> getByTime(String dateStr) {
        BoundHashOperations boundHashOperations = redisTemplate.boundHashOps("seckill_" + dateStr);
        //获取当前时间段参与秒杀的所有商品
        List values = boundHashOperations.values();

        return values;
    }
}
